import java.time.LocalDateTime;
import java.util.Random;

public class Constant {
    public static void main(String[] args) {
        final int MAX_VALUE = 100;         // 整型常量
        final double PI = 3.14159;         // 浮点型常量
        final char CHARACTER = 'A';        // 字符型常量
        final String GREETING = "Hello";   // 字符串常量
        final String EMPTY = null;         // 空常量
        final boolean FLAG = true;         // 布尔常量

        System.out.println(MAX_VALUE);
        System.out.println(PI);
        System.out.println(CHARACTER);
        System.out.println(GREETING);
        System.out.println(EMPTY);
        System.out.println(FLAG);


        final int RANDOM = new Random().nextInt();  // 运行时赋值
        System.out.println(RANDOM);


        final String TIME = LocalDateTime.now().toString();  // 运行时动态生成
        System.out.println(TIME);

        final int MAX = 100;
        int value = MAX * 2;  // 编译后等价于 int value = 200;
        System.out.println(value);

/*        // 不推荐
        if (speed > 120) { ... }

        // 推荐
        final int MAX_SPEED = 120;
        if (speed > MAX_SPEED) { ... }*/

    }
}
